﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using System.Web.Routing;

namespace CoolCode.Web.Mvc
{
    public static  class UrlActionHelper
    {  
        public static string FullAction(this UrlHelper helper, string actionName)
        {
            return getHost() + helper.Action(actionName);
        }

        public static string FullAction(this UrlHelper helper, string actionName, object routeValues)
        {
            return getHost() + helper.Action(actionName,routeValues );
        }

        public static string FullAction(this UrlHelper helper, string actionName, RouteValueDictionary routeValues)
        {
            return getHost() + helper.Action(actionName,routeValues );
        }

        public static string FullAction(this UrlHelper helper, string actionName, string controllerName)
        {
            return getHost() + helper.Action(actionName,actionName ,controllerName );
        }

        public static string FullAction(this UrlHelper helper, string actionName, string controllerName, object routeValues)
        {
            return getHost() + helper.Action(actionName, controllerName,routeValues );
        }

        public static string FullAction(this UrlHelper helper, string actionName, string controllerName, RouteValueDictionary routeValues)
        {
            return getHost() + helper.Action(actionName,controllerName ,routeValues );
        }

        private static string getHost()
        {
            return "http://" + RequestUtility.GetCurrentFullHost();
        }
    }
}
